﻿using University.Workshop.Business;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using University.Workshop.DataAccess;
using System.Collections.ObjectModel;

namespace University.Workshop.Tests
{


    /// <summary>
    ///This is a test class for ContactsManagerTest and is intended
    ///to contain all ContactsManagerTest Unit Tests
    ///</summary>
    [TestClass()]
    public class ContactsManagerTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for SetAll
        ///</summary>
        [TestMethod()]
        public void SetAllTest()
        {
            ContactsManager target = new ContactsManager(); // TODO: Initialize to an appropriate value
            Collection<UserContacts> copy = new Collection<UserContacts>(); // TODO: Initialize to an appropriate value
            UserContacts user1 = new UserContacts();
            user1.UserName = "Juanito";
            user1.UserRequest = "Luchito";
            user1.Status = "Friends";
            UserContacts user2 = new UserContacts();
            user2.UserName = "Luchito";
            user2.UserRequest = "Pepito";
            user2.Status = "Pending";
            copy.Add(user1);
            copy.Add(user2);
            target.SetAll(copy);
        }

        /// <summary>
        ///A test for Separate
        ///</summary>


        /// <summary>
        ///A test for Separate
        ///</summary>
        [TestMethod()]
        public void SeparateTest()
        {
            ContactsManager target = new ContactsManager(); // TODO: Initialize to an appropriate value
            string user = "Luchito"; // TODO: Initialize to an appropriate value
            bool expected = true; // TODO: Initialize to an appropriate value
            bool actual;
            Collection<UserContacts> copy = new Collection<UserContacts>(); // TODO: Initialize to an appropriate value
            UserContacts user1 = new UserContacts();
            user1.UserName = "Juanito";
            user1.UserRequest = "Luchito";
            user1.Status = "Friends";
            UserContacts user2 = new UserContacts();
            user2.UserName = "Luchito";
            user2.UserRequest = "Pepito";
            user2.Status = "Pending";
            copy.Add(user1);
            copy.Add(user2);
            target.SetAll(copy);
            actual = target.Separate(user);
            Assert.AreEqual(expected, actual);
        }
    }
}
